{ include file='../Common/head_article.html' }
<body>
<div class="container-fluid">
    <form action="" method="post" enctype="multipart/form-data">
        <div class="col-sm-12 col-md-12 col-lg-12" style="margin-top: 20px;">
            <p class="article-title">文章标题</p>
            <input value="{$oldData.title}" name="title" type="text" class="form-control" placeholder="请输入文章标题" required/>
        </div>
        <div class="col-sm-12 col-md-12 col-lg-12 article-item-top">
            <p class="article-title">所属分类</p>
            <select name="category_cid" class="form-control" required>
                <option value="">--请选择分类--</option>
                { foreach from="$cateData" item="v" }
                    <option {if $oldData.category_cid eq $v.cid} selected="selected" {/if} value="{$v.cid}">{$v.cname}</option>
                { /foreach }
            </select>
        </div>
        <div class="col-sm-12 col-md-12 col-lg-12 article-item-top">
            <p class="article-title">摘要</p>
            <textarea name="digest" class="form-control quit-drag" placeholder="请输入文章摘要">{$oldData.digest}</textarea>
        </div>
        <div class="col-sm-12 col-md-12 col-lg-12 article-item-top" id="thumb-box">
            <p class="article-title">图片</p>
            {if !empty($oldData.thumb)}
                <img src="{$oldData.thumb}" height="100"/>&nbsp;
                <a href="#" id="img-del" style="color: red;font-weight: 700;text-decoration: none;font-size: 18px;"><span class="glyphicon glyphicon-remove"></span></a>
            {else}
                <input name="thumb" id="thumb" type="file"/>
            {/if}
        </div>
        <div class="col-sm-12 col-md-12 col-lg-12 article-item-top">
            <p class="article-title">内容</p>
            <textarea name="content" class="form-control quit-drag" placeholder="请输入文章内容" required rows="20">{$oldData.content}</textarea>
        </div>
        <input type="hidden" name="thumb" value="{$oldData.thumb}"/>
        <input type="hidden" name="aid" value="{$smarty.get.aid}"/>
        <div class="col-sm-12 col-md-12 col-lg-12" style="margin-top: 15px;">
            <button class="btn btn-primary" type="submit">确 定</button>
            <a class="btn btn-warning" href="javascript:history.go(-1)">返 回</a>
        </div>
    </form>
</div>
{literal}
    <script type="text/javascript">
        $('#img-del').click(function(){
            $('input[name=thumb]').val('');
            var str = '<p class="article-title">图片</p><input name="thumb" id="thumb" type="file"/>';
            $('#thumb-box').html(str);
        })
    </script>
{/literal}
</body>
</html>